Expand description
Minimal HTTP client for both native and WASM.
Example:
let request = ehttp::Request::get("https://www.example.com");
ehttp::fetch(request, move |result: ehttp::Result<ehttp::Response>| {
println!("Status code: {:?}", result.unwrap().status);
});
The given callback is called when the request is completed. You can communicate the results back to the main thread using something like:
- Channels (e.g.
std::sync::mpsc::channel
). Arc<Mutex<_>>
poll_promise::Promise
eventuals::Eventual
tokio::sync::watch::channel
Feature flags
-
native-async
— Supportfetch_async
on native -
streaming
— Support streaming fetch
Modules
- Streaming HTTP client for both native and WASM.
Structs
- An HTTP response status line and headers used for the
streaming
API. - A simple HTTP request.
- Response from a completed HTTP request.
Functions
- Performs an HTTP request and calls the given callback when done.
- Performs an
async
HTTP request. - Performs a HTTP request and blocks the thread until it is done.
- Helper for constructing
Request::headers
.
Type Aliases
- A description of an error.
- A type-alias for
Result<T, ehttp::Error>
.